﻿@using System.Data;
@using ZoomLa.BLL
@using ZoomLa.SQLDAL
@using ZoomLa.Common
@model ZoomLa.SQLDAL.SQL.PageSetting
@{ 
    Model.page_wrap_start = "<li class='clearfix'></li></ul><div class='text-center'>";
    Model.page_wrap_end = "</div>";
    Model.Check = false;
}
@functions{ 
    B_Arrive avBll = new B_Arrive();
    public string GetMoneyRegion(object minAmount ,object maxAmount)
    {
        double min = DataConverter.CDouble(minAmount);
        double max = DataConverter.CDouble(maxAmount);
        return avBll.GetMoneyRegion(min, max);
    }
    public string ShowArriveRegion(DataRow dr)
    {
        if (DataConvert.CLng(dr["StoreID"]) == 0) { return "全平台可用"; }
        else
        {
            string title = DataConvert.CStr(DBCenter.ExecuteScala("ZL_CommonModel", "Title", "GeneralID=" + dr["StoreID"]));
            return "仅限"+title;
        }
    }
}

@if (Model.dt.Rows.Count > 0)
{
    <div id="EGV">
        <ul class="list-unstyled">
            @foreach (DataRow dr in Model.dt.Rows)
            {
                <li class="a_item boxborder" title="点击领取" id="arrive_@dr["Flow"]">
                    <div class="type">
                        <div>
                            <i class="fa fa-rmb"></i>
                            <span class="amount">@DataConverter.CDouble(dr["AMount"]).ToString("f0")</span>
                            <span class="region">@GetMoneyRegion(dr["MinAmount"],dr["MaxAmount"])</span>
                        </div>
                        <div class="r_gray r_item">
                            @ShowArriveRegion(dr)
                        </div>
                        <div class="r_gray r_item">@DataConverter.CDate(dr["AgainTime"]).ToString("yyyy.MM.dd")-@DataConverter.CDate(dr["EndTime"]).ToString("yyyy.MM.dd")</div>
                    </div>
                    <div class="opbtns" style="cursor:pointer;" onclick="getArrive('@dr["Flow"]')">
                        <a>立即领取</a>
                    </div>
                </li>
            }
        </ul>
    </div>
    <input type="hidden" name="flow" id="flow" />
    @Html.Partial("_page", Model)
}
else
{
    <div id="empty_div">
        <div class="alert alert-info">没有待领的优惠券</div>
    </div>
}